package com.itheima.utils;

import lombok.Data;

/**
 * @Author: 放学后海堤日记
 * @Date: 2023/4/7 23:37
 * @Desc:
 */
@Data
public class Result {
    private Integer code;
    private String msg;
    private Object data;

    private Result(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static Result success(Object data) {
        return new Result(1, "success", data);
    }

    public static Result success() {
        return new Result(1, "success", null);
    }

    public static Result error(String message) {
        return new Result(0, message, null);
    }

    public static Result error() {
        return new Result(0, "error", null);
    }
}
